import { type App } from 'vue'

type ModuleImport = Record<string, { default: any }>
export default {
  install(app: App) {
    const module: ModuleImport = import.meta.glob('@/components/common/*.vue', {
      eager: true
    }) as ModuleImport
    for (const iterator in module) {
      const componentName = iterator.slice(iterator.lastIndexOf('/') + 1).split('.')[0]
      app.component(componentName, module[iterator].default)
    }
  }
}
